/* Program 1.1: a class whose instances represent lectures */
class Lecture {
  /* declare the instance variables */
  private int starttimehour;
  private int starttimeminute; 
  private int endtimehour;
  private int endtimeminute;   

  /* declare a constructor to initialise */
  public Lecture(int sth, int stm, int enh, int enm) {
    this.starttimehour = sth;      // store the value of sth in stattimehour
    this.starttimeminute = stm;		// store the value of stm in starttimeminute
    this.endtimehour = enh;			// store the value of enh in endtimehour
    this.endtimeminute = enm;       // store the value of enm in endtimeminute
  }

  /* declare the other methods */
  
  public int getStarttimehour(){
	  return this.starttimehour;
  }
  
  public int getStarttimeminute(){
	  return this.starttimeminute;
  }
  
  public int getEndtimehour(){
	  return this.endtimehour;
  }
  
  public int getEndtimeminute(){
	  return this.endtimeminute ;
  }
  
public double starttimeInMinute(){								//Converts start time to minutes from 00:00
	return ((this.starttimehour * 60) + this.starttimeminute);
}

public double endtimeInMinute(){								//Converts end time to minutes from 00:00
	return ((this.endtimehour * 60) + this.endtimeminute);
}
  public double calculateLecturelength() {						//Calculates the length of a lecture
    return (((this.endtimehour * 60) + this.endtimeminute) - ((this.starttimehour * 60) + starttimeminute));
  } 
  

  
  //Methods for timetable of free time:
  
  public int getStarttimehourBetween(Lecture other){			//Used to determine if there is free time between two lectures
	  return this.starttimehour - other.endtimehour;
  }
  
  public int getStarttimeminuteBetween(Lecture other){			//Used to determine if there is free time between two lectures
	  return this.starttimeminute - other.endtimeminute;
  }
  
}
  
 
